﻿using System;
using System.Collections.Generic;
using CTEM.Controllers.Global;
using CTEM.Controllers.Global;

/// <summary>
/// Entity for table Construction
/// </summary>

namespace CTEM.Models
{
    public class CS_ConstructionDTO
    {
        public const string CONSTRUCTION_MASONRY = "Công Trình Xây Dựng";
        public const string CONSTRUCTION_ROADBRIDGE = "Công Trình Câu Đường";
        public const string CONSTRUCTION_IRRIGATION = "Công Trình Thủy Lợi";

        public const string NEW_CONSTRUCTION = "Mới";
        public const string WORKING_CONSTRUCTION = "Đang Thi Công";
        public const string CANCEL_CONSTRUCTION = "Treo";
        public const string FINISHED_CONSTRUCTION = "Hoàn Thành";

        public long ConstructionID { get; set; }
        public string ConstructionName { get; set; }
        public double ContractValues { get; set; }
        public string ConstructionType { get; set; }
        public string Description { get; set; }
        public string ConstructionAddress { get; set; }
        public DateTime CommencementDate { get; set; }
        public DateTime CompletionDate { get; set; }
        public long ManagerID { get; set; }
        public string Status { get; set; }
        public double ProgressRate { get; set; }
        public bool IsActive { get; set; }
        public bool IsDelete { get; set; }
        public string CreatedBy { get; set; }
        public DateTime CreatedDate { get; set; }
        public string UpdatedBy { get; set; }
        public DateTime LastUpdated { get; set; }

        public HistoryLevel History { get; set; }

        public CS_ConstructionDTO()
        {
            ConstructionID = 0;
            ConstructionName = Constants.EMPTY_TEXT;
            ContractValues = 0;
            ConstructionType = Constants.EMPTY_TEXT;
            Description = Constants.EMPTY_TEXT;
            ConstructionAddress = Constants.EMPTY_TEXT;
            CommencementDate = DateTime.Today;
            CompletionDate = DateTime.Today;
            ManagerID = 0;
            Status = Constants.EMPTY_TEXT;
            ProgressRate = 0;
            IsActive = true;
            IsDelete = false;
            CreatedBy = Global.CurrentUser.Username;
            CreatedDate = DateTime.Today;
            UpdatedBy = Global.CurrentUser.Username;
            LastUpdated = DateTime.Today;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(CS_ConstructionDTO)) return false;
            return Equals((CS_ConstructionDTO)obj);
        }

        public bool Equals(CS_ConstructionDTO other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.ConstructionID, ConstructionID);
        }

        public static bool operator ==(CS_ConstructionDTO left, CS_ConstructionDTO right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(CS_ConstructionDTO left, CS_ConstructionDTO right)
        {
            return !Equals(left, right);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}